{extend name="app/admin/view/base.html"/}
{block name="resources"}
<style>
    .good-name, .good-price {
        line-height: 34px;
    }
</style>
{/block}
{block name="main"}
<div class="layui-form">
    <div class="layui-card ns-card-common">
        <div class="layui-card-header">
            <span class="ns-card-title">分销商信息</span>
        </div>
        <div class="layui-card-body">
            <div class="layui-form-item">
                <label class="layui-form-label">分销商编号：</label>
                <div class="layui-input-inline">
                    {$info.fenxiao_no}
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">分销商：</label>
                <div class="layui-input-inline">
                    {$info.fenxiao_name}
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">上级分销商：</label>
                <div class="layui-input-inline">
                    {if $info.parent_name == ''} 无 {else /}{$info.parent_name} {/if}
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">分销商等级：</label>
                <div class="layui-input-inline">
                    {$level.level_name}
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">当前佣金：</label>
                <div class="layui-input-inline">
                    {$info.account} 元
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">已提现佣金：</label>
                <div class="layui-input-inline">
                    {$info.account_withdraw} 元
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">提现中佣金：</label>
                <div class="layui-input-inline">
                    {$info.account_withdraw_apply} 元
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">当前状态：</label>
                <div class="layui-input-inline">
                    {$status[$info['status']]}
                </div>
            </div>
        </div>
    </div>
    <div class="layui-card ns-card-common">
        <div class="layui-card-header">
            <span class="ns-card-title">账户概况</span>
        </div>
        <div class="layui-card-body">


            <div class="layui-form-item">
                <label class="layui-form-label">一级分销订单总数：</label>
                <div class="layui-input-inline">
                    {$info.one_fenxiao_order_num}
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">一级分销订单总额：</label>
                <div class="layui-input-inline">
                    {$info.one_fenxiao_order_money} 元
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label">一级下线人数：</label>
                <div class="layui-input-inline">
                    {$info.one_child_num} 人
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">一级下线分销商：</label>
                <div class="layui-input-inline">
                    {$info.one_child_fenxiao_num} 人
                </div>
            </div>

        </div>
    </div>
</div>

<div class="layui-form ns-form">
    <div class="ns-form-row">
        {if $info.status == 1}
            <button class="layui-btn ns-bg-color" onclick="refuse()">冻结</button>
        {/if}
        <button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
    </div>
</div>

{/block}
{block name="script"}
<script>
    var fenxiao_id = "{$info.fenxiao_id}";
    function pass() {
        layer.confirm('确定要通过该账户吗?', function () {
            if (repeat_flag) return;
            repeat_flag = true;
            $.ajax({
                url: ns.url("fenxiao://admin/fenxiao/pass"),
                data: {fenxiao_id:fenxiao_id},
                dataType: 'JSON',
                type: 'POST',
                success: function(res) {
                    layer.msg(res.message);
                    repeat_flag = false;
                    if (res.code == 0) {
                        location.reload();
                    }
                }
            });
        })
    }
    function refuse() {
        layer.confirm('确定要拒绝该账户吗?', function () {
            if (repeat_flag) return;
            repeat_flag = true;
            $.ajax({
                url: ns.url("fenxiao://admin/fenxiao/refuse"),
                data: {fenxiao_id:fenxiao_id},
                dataType: 'JSON',
                type: 'POST',
                success: function(res) {
                    layer.msg(res.message);
                    repeat_flag = false;

                    if (res.code == 0) {
                        location.reload();
                    }
                }
            });
        })
    }
    function frozen() {
        layer.confirm('确定要冻结该账户吗?', function () {
            if (repeat_flag) return;
            repeat_flag = true;

            $.ajax({
                url: ns.url("fenxiao://admin/fenxiao/frozen"),
                data: {fenxiao_id:fenxiao_id},
                dataType: 'JSON',
                type: 'POST',
                success: function(res) {
                    layer.msg(res.message);
                    repeat_flag = false;
                    if (res.code == 0) {
                        location.reload();
                    }
                }
            });
        })
    }
    function back() {
        location.href = ns.url("fenxiao://admin/fenxiao/lists");
    }
</script>
{/block}
